#ifndef APPRENTICE_H
#define APPRENTICE_H
#include <string>
#include <cassert>
#include "BaseGameEntity.h"
#include "Locations.h"
#include "ApprenticeOwnedStates.h"
#include "StateMachine.h"
using namespace std;

//Moderated by Strog


//cia = const int Apprentice
const int ciaDiscomfortFlag = 5; 
const int ciaHungerFlag = 5; 
const int ciaThirstFlag = 5; 
const int ciaTiredFlag = 5; 

//okay, now let's actually get to the apprentice
class Apprentice: public BaseGameEntity
{
private:

	State<Apprentice>*			pCurrentState;
	
	location_type				Location;

	//apprentice's needs. the higher the number, the greater the need
	int iThirst;
	int iHunger;
	int iFatigue;
	int iDiscomfort;
	int iHunted;

	string Message;
	string MasterMessage;
public:
	//hacked this hardcore
	StateMachine<Apprentice>*	pStateMachine;
	
	Apprentice(int id): BaseGameEntity(id),
					Location(Treetops),
					iThirst(0),
					iHunger(0),
					iFatigue(0),
					iDiscomfort(0),
					iHunted(0)
	{
		pStateMachine = new StateMachine<Apprentice>(this);
		pStateMachine->SetCurrentState(VisitTreetopsAndPlay::Instance());
	}


	//State<Apprentice> CheckState(); const {return pCurrentState;} //Returns which state the character is in
	void FindActivity();   //Finds highest stat needed to lower and changes state accordingly

	void Update(); //self explanatory
	void ChangeState(State<Apprentice>* pNewState); //also self explanatory

	//simple get function
	location_type funcLocation(){ return Location; }

	void ChangeLocation(location_type loc) { Location = loc; }

	//the following are functions that will increase and decrease his stats, or check them
	bool Thirsty();
	void IncreaseThirst() { iThirst += 1; }
	void DecreaseThirst() { iThirst -= 1; }

	bool Hungry();
	void IncreaseHunger() { iHunger += 1; }
	void DecreaseHunger() { iHunger -= 1; }

	bool Fatigued();
	void IncreaseFatigue() { iFatigue += 1; }
	void DecreaseFatigue() { iFatigue -= 1; }

	bool Uncomfortable();
	void IncreaseDiscomfort() { iDiscomfort += 1; }
	void DecreaseDiscomfort() { iDiscomfort -= 1; }

	int HuntedCheck()		{return iHunted;}
	void HuntedItterator()	{if(iHunted>0)iHunted--;if(iHunted<0)iHunted=0;}
	void HuntedReset()		{iHunted=5;}


	void InputMessage(string M) {Message = M;}
	string OutPutMessage() {return Message;}
	void InputMasterMessage(string M) {MasterMessage = M;}
	string OutputMasterMessage() {return MasterMessage;}
};

#endif
